/*
 * bsp_RTC_ExChip.h
 *
 *  Created on: 2015-4-16
 *      Author: think
 */

#ifndef BSP_RTC_EXT_CHIP_H_
#define BSP_RTC_EXT_CHIP_H_

#define USE_EXCHIP_PCF8583		(0)
#define USE_EXCHIP_S35392A	(1)

#ifndef	TRUE
#define	TRUE		(1)
#endif

#ifndef	FALSE
#define	FALSE		(0)
#endif

#ifndef	NULL_P
#define	NULL_P		((void *) 0)
#endif

typedef struct TTime{
  uint8_t year, month, day, hours, minutes, seconds;
} TTime;

typedef struct{
	uint8_t		year;
	uint8_t		month;
	uint8_t		day;
	uint8_t		hour;
	uint8_t		minute;
	uint8_t		second;
	uint8_t		RSV[2];
}TTime_TypeDef;

#if USE_EXCHIP_PCF8583 == 1

#define	PCF8583_START_YEAR		2000
#define PCF8583_DEVICE_ADDRESS	0xA0

void BSP_InitPCF8583(void);
uint8_t BSP_I2C_CheckPCF8583(uint8_t _Address);

#endif

void BSP_InitRTC(void);
uint8_t BSP_RTC_WriteTime(TTime *TimeRW);
uint8_t BSP_RTC_ReadTime(TTime *TimeRW);

#endif /* BSP_RTC_PFC8583_H_ */
